perm filename EP173[E,ALS] blob
sn#141919 filedate 1975-01-28 generic text, type C, neo UTF8
COMMENT ā VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 SREAD, SREAD1, SREAD2, SREAD3, SREAD4, SRSTOR, SRSTR2
C00013 ENDMK
Cā;
;SREAD, SREAD1, SREAD2, SREAD3, SREAD4, SRSTOR, SRSTR2
;Called by FINDIT (page 175) and FIND (page 176) to read string from TTY
;String is assembled in BUF and must be shorter than 199 characters
SREAD: MOVEI T,
MOVEM E,SAVEE# ;Save this for substitutiion case
CAIN B,3
TRO T,SDELIM
JUMPGE A,.+2
TRO T,SBKWDS
TRZE F,EDITM
TRO T,EDITM
MOVEM T,SRFLG#
MOVMM A,SRCNT#
SETZM SUBFLG# ;To be ready to read searched-for string
MOVE D,[440700,,BUF]
QREAD: MOVNI B,SRSIZ*5-1
TLZ F,TF1
PUSHJ P,TYI
JRST SREAD4 ;Find out the cause of activation
SKIPE SUBFLG ;If we are now reading the substitution string
JRST SREAD1
SETZM SUBARM ;To force a new substitution string
SETZM SUBCNT# ;0 means that a new substitution string is required
SREAD1: IDPB C,D
SREAD2: PUSHJ P,TYI
JRST SRACT ;Now act on extended string
SREAD3: AOJN B,SREAD1
SORRY SEARCH STRING TOO LONG.
SETZB D,SRCNT
AOS -1(P)
JRST SREAD2
;SREAD4 is called if an activation character is recieved before any characters.
;and it allows for ALT interruption. On a LF it returns to
;SREAD2 (with TF1 set in F) to allow for reading of additional TTY input.
;A "\" with bucky bits causes a transfer to QREAD6 which then requires that the
;old substitution string be used.
SREAD4: CAIN C,175
JRST POPTJ
LDB TT,[POINT 7,C,35]
CAIN TT,"\"
JRST QREAD4 ;No new search string for a substitute command
SKIPE SUBFLG ;May be a normal search only
JRST QREAD6 ;Woops! no substitution string
CAIE C,12
JRST SREAD5
TLO F,TF1
SOJA B,SREAD2
QREADX:
CAMN E,SAVEEE
JRST SREAD5 ;Ignore extra \
MOVEM A,QARG#
LDB B,[70200,,C]
ANDI C,177
HRL C,B
MOVEM C,QCHR#
SUBI B,2 ;So -1 for <CONTROL>, 0 for <META> and 1 for both
MOVEM B,SUBFLG
MOVNI B,SRSIZ*5-1
MOVE A,[441100,,BUF]
MOVE T,SRCSIZ(E)
PUSHJ P,NUMSTR
MOVEI C,0
IDPB C,A ;Temporary termination for number
MOVE D,[441100,,BUF] ;This must be in 9-bit
MOVEM D,QDSP#
ILDB C,D
JUMPE C,.+4 ;Test for end of number
ADDI C,200 ;Add CONTROL bit
DPB C,D
JRST .-4
MOVEI C,304 ; Delete symbol
DPB C,D
CAMN E,[FNDBUF]
MOVEI E,SUBBUF
CAMN E,[FNDTBF]
MOVEI E,SUBTBF
MOVEM E,SAVEEE# ;Set for substitution buffer
MOVNI B,SRSIZ*5-1
TLZ F,TF1
PUSHJ P,TYI
JRST QREAD4 ;Find out the cause of activation
; SKIPE SUBFLG ;If we are now reading the substitution string
; JRST QREAD1
; SETZM SUBARM ;To force a new substitution string
; SETZM SUBCNT# ;0 means that a new substitution string is required
QREAD1: ADDI C,400 ;Add the META bit
IDPB C,D
QREAD2: PUSHJ P,TYI
JRST QRACT ;Now act on extended string
QREAD3: AOJN B,QREAD1
SORRY SUBSTITUTION STRING IS TOO LONG.
SETZB D,SRCNT
AOS -1(P)
JRST QREAD2
;We only get here if there is a substitution string.
QRACT:
CAIN C,175
JRST POPTJ
LDB TT,[POINT 7,C,35]
CAIN TT,"\"
JRST QREAD2 ;Ignore the second \
PUSHJ P,QRACT2 ;Set up termination information
MOVEI TT,
IDPB TT,D
TLNE D,760000 ;WE MUST TEST IF THIS WORKS ON 9-bit
JRST .-2
MOVSI TT,BUF
HRRI TT,SRCBUF(E)
SUBI D,BUF
ADDI D,(TT)
BLT TT,(D)
ADDI B,SRSIZ*5-1+1
MOVEM B,SRCSIZ(E)
SETOM SUBFLG
JRST SREAD5
;We must now have information as to a possible repeat. With a repeat we do not
;want to flush the search code
QRACT2: LDB C,[70200,,QCHR]
HRLM C,QCHR ;This in the left half sgnals substitution string
CAIE C,3 ;A 3 means repeat
JRST QRACT3
AOS SUBCNT ;Add to substitution count
MOVEI C,FNDBSL
CAMN E,SUBBUF
MOVEI C,FINBSL
SKIPA
QRACT3: MOVEI C,BSLXC5
MOVEM C,SRCFLG(E) ;Store in the flag cell
POPJ P,
OUTSTR [ASCIZ /
This is a VERY DANGEROUS command. ****
**** Do you really want a NULL substitution? (Type Y or N) /]
PUSHJ P,YESCHK
JRST QREA5
OUTSTR [ASCIZ /
Type substitution string over again and proceed, or type ALT to abort.
/]
JRST QREAD
QREA5: SETZM SRCSIZ(E) ;
MOVEI E,1
MOVEM E,SUBARM
MOVE E,SAVEE ;Restore correct value for the search
;This code is entered from SREAD4 when a \ is the first character showing that
;no new search string is to be typed. This is acceptable only if SUBARM is still
;set from a previous substitution and if it is not a second \
QREAD4: SKIPE SUBARM
SKIPE SUBFLG
JRST QREAD7 ;To force a redefining of substitution string
LDB B,[70200,,C]
ANDI C,177
HRL C,B
MOVEM C,QCHR#
SUBI B,2 ;So -1 for <CONTROL>, 0 for <META> and 1 for both
MOVEM B,SUBFLG ;Redefine in case of a change in bucky bits
JRST SREAD6 ;Now go as a repeat substitution
;QREAD5 is called in SRACT if a \ first string termination is received and
;it saves the \ command in 0CHR, the character "\" in the right ralf and the
;control bits in the left half. SUBFLG is also set to -1 on a CONTROL, to
;0 on a META and to +1 on both CONTROL and META.
QREAD5:
CAMN E,SAVEEE
JRST SREAD5 ;Ignore extra \
CAMN E,[FNDBUF]
MOVEI E,SUBBUF
CAMN E,[FNDTBF]
MOVEI E,SUBTBF
MOVEM E,SAVEEE# ;Set for substitution buffer
MOVE D,[440700,,BUF2]
MOVEM D,QDSP#
MOVEM A,QARG#
LDB B,[70200,,C]
ANDI C,177
HRL C,B
MOVEM C,QCHR#
SUBI B,2 ;So -1 for <CONTROL>, 0 for <META> and 1 for both
MOVEM B,SUBFLG
JRST QREAD
;QREAD6 is entered when a new searched-for string has been typed but a null
;substitution string is encountered. Verification is then requested.
QREAD6: OUTSTR [ASCIZ /
**** Do you really want a null substitution? (Type Y or N)
This IS a very dangerous thing to do, so be sure. /]
PUSHJ P,YESCHK
JRST QREAD8
OUTSTR [ASCIZ /
Type corrected substitution string and proceed, or type <ALT> to abort. /]
JRST QREAD
JRST POPTJ ;Abort
QREAD7: SETZM SUBFLG
SETZM SUBCNT
SETZM QCHR
OUTSTR [ASCIZ /No proper substitution string.
Substitution aborted. You must now retype entire command.
/]
JRST POPTJ
QREAD8: JSP Q,QRSTR3
JRST SREAD6
;SRSTOR stores the searched-for string away and gets QSTOR to do the same for
;the substitution string.
SRSTOR: SKIPE SUBFLG ;Is this the searched-for string
JRST QSTOR ;No it is the substitution string
JUMPLE D,SRSTR2
MOVEI TT,
IDPB TT,D
TLNE D,760000
JRST .-2
MOVSI TT,BUF
HRRI TT,SRCBUF(E)
SUBI D,BUF
ADDI D,(TT)
BLT TT,(D)
ADDI B,SRSIZ*5-1+1
MOVEM B,SRCSIZ(E)
SRSTR2: JUMPN D,.+2
MOVEI E,SRDUMY
SETZM SRCFLG(E)
SETOM SUBARM#
JRST (Q)
QSTOR:
JUMPLE D,QRSTR2
MOVEI TT,
IDPB TT,D
TLNE D,760000
JRST .-2
MOVSI TT,BUF2
HRRI TT,SRCBUF(E)
SUBI D,BUF2
ADDI D,(TT)
BLT TT,(D)
ADDI B,SRSIZ*5-1+1
MOVEM B,SRCSIZ(E)
QRSTR2:
JUMPN D,QRSTR3
OUTSTR [ASCIZ /
**** Do you really want a null substitution? (Type Y or N) /]
PUSHJ P,YESCHK
SKIPA
JRST POPTJ ;Abort
QRSTR3: SETZM SRCFLG(E)
MOVEI E,1
MOVEM E,SUBARM
MOVE E,SAVEE ;Restore correct value for the search
JRST (Q)